# -*- coding: utf-8 -*-
"""
main
2025/9/9
@author: zhangzida
"""
from Base import Base
from selenium.webdriver.common.by import By
import time

class Page(Base):
    dy1_loc=(By.XPATH,'/html/body/div/div/div[2]/a')
    search_loc=(By.ID,'kw')
    dy2_loc=(By.XPATH,'/html/body/div[3]/div[3]/div[1]/div[3]')
    two_loc=(By.XPATH,'/html/body/div[3]/div[4]/div[2]/div/div/a[1]/span')
    dy3_loc=(By.XPATH,'/html/body/div[3]/div[3]/div[1]/div[3]')


    def dy1(self):
        return self.text(self.dy1_loc)

    def search(self):
        self.send_keys(self.search_loc,'我喜欢软件测试')
    def huiche(self):
        self.enter(self.search_loc)
    def dy2(self):
        return self.text(self.dy2_loc)
    def two(self):
        self.click(self.two_loc)
    def dy3(self):
        return self.text(self.dy3_loc)


    def luoji_baidu(self):
        self.open_url('https://www.baidu.com/')
        time.sleep(3)
        # print(self.dy1())
        self.search()
        time.sleep(3)
        self.huiche()
        time.sleep(3)
        print(self.dy2())
        assert '软件测试' in self.dy2()
        self.scrollTo()
        time.sleep(2)
        self.two()
        time.sleep(2)
        print(self.dy3())
        assert '软件测试' in self.dy3()